public class Demo1 {
    public static int getSum(int num) {
        int sum = 0;
        if (num == 1) return 1;
        return getSum(num - 1) + num;
    }

    public static void main(String[] args) {
        int sum1 = 0, sum2 = 0, sum3 = 0;
        sum1 = getSum(3);
        sum2 = getSum(5);
        sum3 = getSum(10);
        System.out.println(sum1);
        System.out.println(sum2);
        System.out.println(sum3);
    }
}
